Skip to content

Fix getting views for Hive metastore 2.3+ #24466

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
imsayari404:clob_issue
Feb 4, 2025
Merged

Fix getting views for Hive metastore 2.3+ #24466
tdcmeehan merged 1 commit intoprestodb:masterfrom
imsayari404:clob_issue

Conversation

@imsayari404
Copy link
Copy Markdown
Contributor

@imsayari404 imsayari404 commented Jan 31, 2025

On certain databases (e.g. Derby, Oracle) it uses CLOB and these databases disallow = predicates over CLOB values. At the same time, they allow LIKE predicates over them.

cherry-picked : trinodb/trino#833

Description

Added a new private method getPrestoViews(String databaseName):

  1. Uses get_table_names_by_filter to fetch tables marked as Presto views.
  2. Introduced fallback logic:
    a. First attempts = predicate on PRESTO_VIEW_FLAG.
    b. If it fails, attempts LIKE predicate.
    c. Stores successful attempts in metastoreKnownToSupportTableParamEqualsPredicate and metastoreKnownToSupportTableParamLikePredicate.

Motivation and Context

Hive 2.3 metastore provides more space for table parameter values. On certain databases (e.g. Derby, Oracle) it uses CLOB and these databases disallow = predicates over CLOB values. At the same time, they allow LIKE predicates over them.

This fixes SHOW TABLES and queries over information_schema.tables.

Also, fixes #10735, nico-arianto/big-data-local#1.

Impact

Clob datatype issue resolved.

Test Plan

checked using presto-cli.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Hive Connector Changes
*  Fix getting views for Hive metastore 2.3+

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Jan 31, 2025
@imsayari404 imsayari404 marked this pull request as ready for review January 31, 2025 10:30
@imsayari404 imsayari404 requested a review from a team as a code owner January 31, 2025 10:30
Copy link
Copy Markdown
Contributor

@tdcmeehan tdcmeehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the instructions for Backport Commits in our commit standards.

@imsayari404
Copy link
Copy Markdown
Contributor Author

@tdcmeehan , could you review this pr at your convenience?

On certain databases (e.g. Derby, Oracle) it uses CLOB and these databases disallow `=` predicates over CLOB values. At the same time, they allow
`LIKE` predicates over them.

Cherry-pick of prestodb@179ffe4
Co-authored-by: Piotr Findeisen <piotr.findeisen@gmail.com>
Copy link
Copy Markdown
Contributor

@pratyakshsharma pratyakshsharma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a line break in second line of commit description. Will be good to correct that.

@steveburnett
Copy link
Copy Markdown
Contributor

New release note guidelines as of last week: PR #24354 automatically adds links to this PR to the release notes. Please remove the manual PR link in the following format from the release note entries for this PR.

:pr:`12345`

I have updated the Release Notes Guidelines to remove the examples of manually adding the PR link.

@agrawalreetika
Copy link
Copy Markdown
Member

There is a line break in second line of commit description. Will be good to correct that.

I think we leave a blank line at the end of the class variable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Presto java.net.SocketTimeoutException: timeout java.io.UncheckedIOException: java.net.SocketTimeoutException: timeout

6 participants